
// 获取集团概况对应的code
export function getCode(menus, path) {
    let currentMenu = null
    let currentInfo = null
    for (let index = 0; index < menus.length; index++) {
        const element = menus[index];
        if (path.indexOf(element.colPath) != -1) {
            currentMenu = element
            break
        }
    }
    if (currentMenu) {
        for (let index = 0; index < currentMenu.children.length; index++) {
            const element = currentMenu.children[index];
            if (element.colPath == path) {
                currentInfo = element
                break
            }
        }
    }
    return currentInfo
}

export function getCodeById(menus, colId) {
    let currentMenu = null
    if (!colId) {
        return {}
    }
    for (let index = 0; index < menus.length; index++) {
        const element = menus[index];
        if (colId.indexOf(element.colId) != -1) {
            currentMenu = element
            break
        }
    }
    return currentMenu
}